<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
Copyright (C) 2006 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<head>
<title>README: Google Checkout - web stores Javascript Bridge</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<h2>Introduction </h2>
<p>This is a proof-of-concept integration that allows you to add a Google Checkout button to an ecommerce store checkout page, and is known to work with some Yahoo! stores. </p>
<h2>How It Works </h2>
<p>The implementation has three parts: </p>
<ol>
  <li>The first step is to insert a script tag in your HTML template for your shopping cart page. This tag needs to load the Javascript-side implementation of the bridge (add-checkout.js), which will render a Google Checkout button at that point in the page. <br>
    A bookmarklet (bookmarklet.html) has been provided for testing purposes. The bookmarklet inserts a script tag similar to the one a merchant would insert in their HTML template; it should not actually be a part of a deployed solution. </li>
  <li>When the user clicks the checkout button, the Javascript code (add-checkout.js) scans through the DOM of the page looking for the HTML table which contains the items. It identifies this table based on the column header names like &quot;Item&quot;, &quot;Qty&quot; or &quot;Quantity&quot;, &quot;Unit Price&quot;, and &quot;Options&quot;. It records the column index of each identified header. Having located the table, it looks through the rows, identifying items and extracting their data. It then formats the data for all the rows and submits that to the PHP script. </li>
  <li>When the PHP script (processCart.php) receives a set of items, it formats them into a valid Google Checkout cart. It could also add tax &amp; shipping configuration or validate prices on items. Having prepared the XML cart, it submits it to Google Checkout with the &quot;alternative cart submission method&quot; (by posting it to Google in a server-to-server post), and receiving a URL back from Google, redirects the user to that checkout URL. </li>
</ol>
<h2>To Setup and Test the Integration </h2>
<ol>
  <li>You will need to host bookmarklet.html, add-checkout.js, and processCart.php on a web server. The PHP script requires the cURL module to be compiled into PHP. </li>
  <li>Each of the files needs to be edited to configure it for your hosting URLs, merchant ID, and merchant key. Search for EDIT_ME in each file to find edit locations. </li>
  <li>Open bookmarklet.html, and add the link to your bookmarks. </li>
  <li>Browse to a store and add things to your cart. </li>
  <li>From the store's &quot;view cart&quot; page (with a &quot;Checkout&quot; link or button), choose the bookmark you added in step 1. </li>
  <li>A &quot;Checkout With Google&quot; button should appear on the page, probably at the bottom. Click it. </li>
  <li>You should now see a Google Checkout screen listing your order. </li>
</ol>
<h2>Notes &amp; Caveats </h2>
<ul>
  <li>The script doesn't yet include any example tax &amp; shipping calculations. </li>
  <li>It may not be possible to duplicate all possible tax &amp; shipping configurations: </li>
  <ul>
    <li>The scripts may not have access to the metadata necessary for some calculations (e.g., item weight). </li>
    <li>Some stores may support some methods not supported by Google Checkout (e.g., UPS calculations). </li>
  </ul>
  <li>The typical store often doesn't have enough data to come up with good item descriptions. If the item has options, the scripts use those, and that works well, but if there are no options, the description is left blank. </li>
  <li>For items with extensive options, the Checkout UI truncates the item description. Users cannot see the full item specification, and merchants who process orders via the UI may not be able to see it either. </li>
  <li>Some Yahoo! Stores use an HTML layout the script doesn't support. (The &quot;Item&quot; header column spans two columns in the actual item rows: the thumbnail and the item description.) This is pretty easy to work around, but the code doesn't support it right now. </li>
  <li>The PHP script just copies the items submitted into a Google Checkout cart and begins the checkout process. It would be fairly easy for users to modify prices and begin checkout with carts not authorized by the merchant. To protect against this, merchants must double-check the prices on invoices while processing orders. Alternately, if a product catalog with prices is available, it may be possible to have the PHP script validate prices before creating a Google Checkout cart. </li>
  <li>Handling of i18n characters and non-breaking spaces is probably not correct. </li>
  <li>This is code that you might find useful in integrating Google Checkout with your existing store. Keep in mind, this code may or may not work for your particular store. We're providing it to spark ideas. It works with some stores, and we believe it works for some Yahoo stores. Google is not able to provide support to integrate and implement this code: it is simply a proof of concept and is offered without any commitment to support this in an ongoing fashion. </li>
  <li>If you have questions about the Yahoo Stores terms of service, please contact your own legal counsel.</li>
</ul>
</body>
</html>
